Skip to content

Migrate to Centralized NuGet Package Management (CPM)#12

Merged
Tyrrrz merged 2 commits intomasterfrom
copilot/migrate-to-centralized-nuget-management
Feb 26, 2026
Merged

Migrate to Centralized NuGet Package Management (CPM)#12
Tyrrrz merged 2 commits intomasterfrom
copilot/migrate-to-centralized-nuget-management

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

Moves package version management from per-project Version attributes to NuGet CPM, consolidating all versions in a single Directory.Packages.props file.

Changes

  • Directory.Packages.props (new): root-level CPM file with ManagePackageVersionsCentrally=true and a PackageVersion entry for each unique package, sorted alphabetically:
    <PackageVersion Include="CSharpier.MsBuild" Version="1.0.2" />
  • *.csproj files: removed Version="..." from all <PackageReference> elements; all other attributes (PrivateAssets, etc.) preserved.
  • Deorcify.sln: added Directory.Packages.props as a solution item under the existing Misc folder alongside Directory.Build.props.
Original prompt

Migrate to Centralized NuGet Package Management (CPM)

Migrate the repository from per-project Version attributes on <PackageReference> to NuGet's Centralized Package Management (CPM).

What to do

  1. Create a Directory.Packages.props file at the root of the repository with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and a <PackageVersion> entry for every unique package used across all .csproj files. Use the version already present in the .csproj files.

  2. Update all .csproj files to remove the Version="..." attribute from every <PackageReference> element (CPM now manages the version centrally). Keep all other attributes (e.g. PrivateAssets, Condition, ExcludeAssets, etc.) intact.

  3. Add Directory.Packages.props to the .sln file as a solution item, typically under a Solution Items folder, so it is visible and accessible from within the solution.

  4. Run dotnet build at the end to catch and fix any formatting or structural issues introduced during the migration.

  5. Do not change any TargetFramework(s), project structure, or anything unrelated to package versioning.

Reference

See how it was done in the sibling repo Tyrrrz/YoutubeExplode PR #940: Tyrrrz/YoutubeExplode#940

Notes

  • If a package appears with different versions in different projects, use the highest version and make a note in the PR description.
  • <PackageVersion> entries in Directory.Packages.props should be sorted alphabetically.
  • Make sure the file includes a valid MSBuild props file <Project> root element.
  • Preserve all Condition attributes on <PackageReference> elements.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
@Tyrrrz Tyrrrz added the enhancement New feature or request label Feb 26, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review February 26, 2026 19:47
Copilot AI review requested due to automatic review settings February 26, 2026 19:47
Copilot AI changed the title [WIP] Migrate to Centralized NuGet Package Management in repository Migrate to Centralized NuGet Package Management (CPM) Feb 26, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the repository to NuGet Central Package Management (CPM) by moving package version declarations into a root Directory.Packages.props and removing per-project Version attributes, while keeping the solution updated to surface the new file.

Changes:

  • Added root Directory.Packages.props enabling CPM and defining the CSharpier.MsBuild version.
  • Removed Version="..." from CSharpier.MsBuild PackageReferences in both projects.
  • Added Directory.Packages.props to solution items in Deorcify.sln.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Directory.Packages.props Enables CPM and centrally defines CSharpier.MsBuild version.
Deorcify/Deorcify.csproj Drops per-project package version in favor of CPM.
Deorcify.Demo/Deorcify.Demo.csproj Drops per-project package version in favor of CPM.
Deorcify.sln Includes Directory.Packages.props as a solution item for visibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Tyrrrz Tyrrrz merged commit 766f6ac into master Feb 26, 2026
9 checks passed
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-centralized-nuget-management branch February 26, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants